package seqList.LeetCode;
//LeetCode 第160题 相交链表求交点
public class Num160 {
    public ListNode getIntersectionNode(ListNode headA, ListNode headB) {
        ListNode pA = headA;
        ListNode pB = headB;
        //1.相交时刚好回到交点
        //2.不相交两个同时走到NULL
        while (pA!=pB){
            pA = pA == null ? headA:pA.next;
            pB = pB == null ? headB:pB.next;
        }
        return pA;
    }
}
